package aufgabe1.teilaufgabe1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA. User: iamapo Date: 14.10.13 Time: 12:09 To change
 * this template use File | Settings | File Templates.
 */
public class main {

	public static void main(String[] args) throws IOException {

		List<Double> list = new ArrayList();

		int x = 1;
		long time = 0;
		long time1 = 0;
		while (x == 1) {

			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			System.out.print("Gib die " + (list.size() + 1) + "te Zahl ein: ");
			String eingabe = br.readLine();
			Double dObj2 = Double.valueOf(eingabe);
			list.add(dObj2);
			long timeStartlocal = System.nanoTime();
			System.out.println("Varianz: " + Algorithm.var(list));
			long timeEndlocal = System.nanoTime();
			time = time + (timeEndlocal - timeStartlocal);
			System.out.println("Laufszeit: " + time + " Millisek.");
			timeStartlocal = System.nanoTime();
			System.out.println("Mittelwert: " + Algorithm.middle(list));
			timeEndlocal = System.nanoTime();
			time1 = time1 + (timeEndlocal - timeStartlocal);
			System.out.println("Laufszeit: " + time1 + " Millisek.");

		}
	}

}
